﻿using System;
using System.Web.Mvc;
using System.Collections.Generic;
using WD.Framework.Web;
using WD.Core.Log;
using WD.Db.Contract;

namespace WD.Web
{
    public abstract partial class ControllerBase : WD.Framework.Web.ControllerBase
    {

        //        public virtual IAuditLogService AuditLogService
        //        {
        //            get
        //            {
        //                return ServiceContext.Current.AuditLogService;
        //            }
        //        }

        public virtual IShop_LoginInfoService Shop_LoginInfoService
        {
            get
            {
                return ServiceContext.Current.Shop_LoginInfoService;
            }
        }

        protected override void LogException(Exception exception, WebExceptionContext exceptionContext = null)
        {
            base.LogException(exception);

            var message = new
            {
                exception = exception.Message,
                exceptionContext = exceptionContext,
            };

            Log4NetHelper.Error(LoggerType.WebExceptionLog, message, exception);
        }

        public IDictionary<string, object> CurrentActionParameters { get; set; }

        protected override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);
        }

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
        }
    }
}
